//
//  GHFormDetailViewController.m
//  GodHorses
//
//  Created by Mac on 2017/11/23.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHFormDetailViewController.h"
#import "GHFormView.h"
@interface GHFormDetailViewController ()
@property(nonatomic, strong) GHFormView                     *moneyView;
@property(nonatomic, strong) GHFormView                     *orderView;
@property(nonatomic, strong) GHFormView                     *timeView;
@property(nonatomic, strong) GHFormView                     *payTypeView;//支付方式
@property(nonatomic, strong) GHFormView                     *shenmaView;
@property(nonatomic, strong) GHFormView                     *seviceView;//平台服务费
@property(nonatomic, strong) GHFormView                     *typeView;//支付类型
@property(nonatomic, strong) GHFormView                     *statusView;

@property(nonatomic, strong) GHFormView                     *mechanNameView;//店铺名字
@property(nonatomic, strong) GHFormView                     *mechanAddView;//店铺地址
@property(nonatomic, strong) GHFormView                     *userAccountView;//用户账号
@property(nonatomic, strong) GHFormView                     *userPhoneView;//用户姓名
@property(nonatomic, strong) GHFormView                     *goodTypeView;//商品分类
@property(nonatomic, strong) GHFormView                     *numView;//商品数量


@end

@implementation GHFormDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"报单详情";
    [self configSubView];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    UIView * headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 200)];
    headerView.backgroundColor = [UIColor whiteColor];
    self.tableView.tableHeaderView = headerView;
    
    self.moneyView = [[GHFormView alloc] initWithFrame:CGRectMake(0, 10, UIScreenWidth, 25)
                                             leftTitle:@"水"
                                        leftTitleColor:GH_firstTextColor
                                            rightTitle:@"2000"
                                       rightTitleColor:GH_YellowBackGroundColor];
    [headerView addSubview:self.moneyView];
    
    self.orderView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.moneyView.bottom, UIScreenWidth, 25)
                                             leftTitle:@"订单号"
                                        leftTitleColor:GH_secendTextColor
                                            rightTitle:@"-----"
                                       rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.orderView];
    
    
    
    self.timeView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.orderView.bottom , UIScreenWidth, 25)
                                            leftTitle:@"下单时间"
                                       leftTitleColor:GH_secendTextColor
                                           rightTitle:@"-----"
                                      rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.timeView];
    
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(10, self.timeView.bottom , UIScreenWidth - 20, 0.5)];
    line.backgroundColor = GH_lineColor;
    [headerView addSubview:line];
    
    self.payTypeView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.timeView.bottom + 0.5, UIScreenWidth, 25)
                                               leftTitle:@"现金支付"
                                          leftTitleColor:GH_secendTextColor
                                              rightTitle:@"140"
                                         rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.payTypeView];
    
    self.shenmaView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.payTypeView.bottom + 0.5, UIScreenWidth, 25)
                                              leftTitle:@"神马值支付"
                                         leftTitleColor:GH_secendTextColor
                                             rightTitle:@"140"
                                        rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.shenmaView];
    
    self.seviceView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.shenmaView.bottom, UIScreenWidth, 25)
                                              leftTitle:@"平台服务费"
                                         leftTitleColor:GH_secendTextColor
                                             rightTitle:@"28.0"
                                        rightTitleColor:GH_YellowBackGroundColor];
    [headerView addSubview:self.seviceView];
    
    self.typeView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.seviceView.bottom, UIScreenWidth, 25)
                                            leftTitle:@"支付类型"
                                       leftTitleColor:GH_secendTextColor
                                           rightTitle:@"现金支付"
                                      rightTitleColor:GH_YellowBackGroundColor];
    [headerView addSubview:self.typeView];
    
    
    self.statusView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.typeView.bottom, UIScreenWidth, 25)
                                              leftTitle:@"状态"
                                         leftTitleColor:GH_secendTextColor
                                             rightTitle:@"待确认"
                                        rightTitleColor:GH_YellowBackGroundColor];
    [headerView addSubview:self.statusView];
    
    
    //详细
    self.mechanNameView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.statusView.bottom, UIScreenWidth, 25)
                                                 leftTitle:@"商家备注"
                                            leftTitleColor:GH_secendTextColor
                                                rightTitle:@"待确认"
                                           rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.mechanNameView];
    
    self.mechanAddView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.mechanNameView.bottom, UIScreenWidth, 25)
                                                  leftTitle:@"店铺地址"
                                             leftTitleColor:GH_secendTextColor
                                                 rightTitle:@""
                                            rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.mechanAddView];
    
    self.userAccountView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.mechanAddView.bottom, UIScreenWidth, 25)
                                                 leftTitle:@"买家账号"
                                            leftTitleColor:GH_secendTextColor
                                                rightTitle:@"---"
                                           rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.userAccountView];
    
    self.goodTypeView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.userAccountView.bottom, UIScreenWidth, 25)
                                                   leftTitle:@"商品分类"
                                              leftTitleColor:GH_secendTextColor
                                                  rightTitle:@"---"
                                             rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.goodTypeView];
    
    
    self.numView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.goodTypeView.bottom, UIScreenWidth, 25)
                                                leftTitle:@"商品数量"
                                           leftTitleColor:GH_secendTextColor
                                               rightTitle:@"---"
                                          rightTitleColor:GH_secendTextColor];
    [headerView addSubview:self.numView];
    
    headerView.height = self.numView.bottom + 10;
    self.tableView.tableHeaderView = headerView;
    
    self.model = self.model;
    
}
- (void)setModel:(GHMerchanModel *)model{
    _model = model;
    
    self.moneyView.textLabel.text = model.goods_name;
    self.moneyView.detailLabel.text = model.shopping_money;
    
    self.orderView.detailLabel.text = model.oid;
    
    NSDate * date = [NSDate dateWithTimeIntervalSince1970:[model.stime integerValue]].st_localDate;
    self.timeView.detailLabel.text = date.st_yyyyMMddhhmmssWithDate;
    
    self.payTypeView.detailLabel.text = model.cash_money;
    
    self.shenmaView.detailLabel.text = model.smz_money;
    
    self.seviceView.detailLabel.text = model.service_money;
    
    self.typeView.detailLabel.text = model.paySrting;
    
    self.statusView.detailLabel.text = model.statusString;
    
    //
    self.mechanNameView.detailLabel.text = model.business_note;
    
  //  self.mechanAddView.detailLabel.text = model.business_note;
    
    self.userAccountView.detailLabel.text = model.buy_username;
    
    self.userPhoneView.detailLabel.text = model.buy_username;
    
    self.goodTypeView.detailLabel.text = model.goods_cate;
    
    self.numView.detailLabel.text = model.goods_count;
    
    
    
}

@end
